import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
	state: {
		userInfo: uni.getStorageSync('user') || {},
		token: uni.getStorageSync('token') || ''
	},
	mutations: {
		serUserInfo(state, value) {
			state.userInfo = value
		},
		setToken(state, token){
			state.token = token
		}
	},
	getters: {
		getUserInfo: state => {
			return state.userInfo
		},
		getToken: state => {
			return state.token
		}
	},
	actions: {}
})
